package com.alt.www.leetCode;

import java.util.ArrayList;
import java.util.LinkedList;

/**
 * Created by wangyang on 2017/12/7.
 */
public class RegularMatch {
    public boolean isMatch(String s, String p) {
        char[] charstemsps = s.toCharArray();
        char[] temps = p.toCharArray();

        LinkedList<String> charsets = new LinkedList<String>();
        for(int index=0;index<charstemsps.length;index++){
            charsets.add(String.valueOf(charstemsps[index]));
        }
        LinkedList<String> regulars = new LinkedList<String>();
        for(int index=0;index<temps.length;index++){
            String regular = "";
            if(temps[index]=='.'||temps[index]=='*'){
                regular=String.valueOf(temps[index]);
            }else {
                if(temps[index + 1]=='.'||temps[index + 1]=='*'){
                    regular=String.valueOf(temps[index])+String.valueOf(temps[index+1]);
                }else{
                    regular=String.valueOf(temps[index]);
                }
            }
            regulars.add(regular);
        }
        boolean repoll = true;
        boolean charpoll = true;
        String charStr= "";
        String reStr = "";
        while (true){
            if(charpoll)
                charStr  = charsets.pollFirst();
            if(repoll)
                reStr = regulars.pollFirst();
            if(reStr.equals(".")){

            }else if(reStr.equals("*")){

            }else {
                String c = reStr.substring(0,1);
                String re = reStr.substring(1,2);
                if(re.equals("*")){
                    if(c.equals(charStr)){
                        continue;
                    }
                }else{

                }

            }
        }





    }
}
